home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / hp48hor1 / hardkeys.doc < prev    next >
Text File  |  1995-03-31  |  13KB  |  246 lines

  1. (Comp.sys.handhelds) 
  2. Item: 3767 by ftg0673 at tamsun.TAMU.EDU 
  3. Author: [Rick Grevelle] 
  4.   Subj: HP48 Conference Preview 
  5.   Date: Thu Jul 25 1991 
  6.  
  7. This is one of the topics I plan to discuss in detail at the up and coming 
  8. Handhelds Conference in Corvallis.  Since there are those who will not wish 
  9. to wait until then to take advantage of this material, it is appropriately 
  10. complete to now provide a sneak preview.  However the finer details will be 
  11. reserved for the conference itself.  
  12.  
  13.  
  14. Rick Grevelle 
  15. ftg0673@tamsun.tamu.edu 
  16. (409) 774-1169 
  17.  
  18.  
  19. =========================================================================== 
  20.  
  21.  
  22.                    HP48 Hard Key Assignment Interrupts 
  23.          
  24.   Normally each time one of the HP48's forty nine keys is pressed two system 
  25. binaries are pushed to the stack by the underlying operating system.  These 
  26. are never seen by the user who is probably unaware that his or her calculator 
  27. is using the very same stack for the SYSTEM RPL as is used by the USER RPL.  
  28. Once a key is pressed and the two system binaries are pushed to the stack, it 
  29. is then up to the SYSTEM RPL to make a decision base on the value of these 
  30. results as to what to do next (i.e. change menus, execute functions, initiate 
  31. the command line, etc.). 
  32.  
  33.   Interrupting the SYSTEM RPL responsible for interpreting and executing the 
  34. actual key stroke is easily done.  It is then possible to substitute a user 
  35. scheme to effectively handle the task of key press management, but this is no 
  36. small job, and the process can become quite lengthy.  All details regarding 
  37. the interrupt mechanism and the SYSTEM RPL management of key presses will not 
  38. be addresses here as I'm saving it for the August conference.  What will be 
  39. covered here is involved enough for now, and should be more than adequate for 
  40. the majority of users.  In other words, I'm providing all the support tools 
  41. necessary for interrupting the 48's hard key assignments.  Keeping it in mind 
  42. that this has nothing to do with the user key assignments as I have gone to 
  43. great lengths to maintain the integrity of this feature that actually coexists 
  44. with the regular key assignments. 
  45.  
  46.   The two directories at the end of this article are suitable for converting 
  47. to library format.  The first will be primarily of interest to those concerned 
  48. with hard addressing key assignments in software intended for ROM cards, and 
  49. the second for those who wish to perform interrupts from RAM.  Although I have 
  50. tried to stick to entry points supported by Hewlett-Packard, it wasn't always 
  51. possible to do so. I apologize for this, especially to those who haven't spent 
  52. the majority of their spare time for the past two years peeking at the hex in  
  53. the HP28/48.  So with all that said, let's get started.  
  54.  
  55.  
  56.  
  57.         o  Hard key assignments in the 48 are found in the hidden ROM 
  58.            and packaged in an Array of System Binary data object that 
  59.            contains forty nine System Binary elements.  Each of these 
  60.            elements is in fact the address of another Array of System 
  61.            Binary within the hidden ROM containing six elements which 
  62.            are the addresses of the various key configurations that a 
  63.            particular key is assigned.  Each element corresponds to a 
  64.            specific key-shift pattern as follows: 
  65.  
  66.  
  67.                         1st element:    unshifted 
  68.                         2nd element:    left-shifted 
  69.                         3rd element:    right-shifted 
  70.                         4th element:    alpha-shifted 
  71.                         5th element:    alpha-left-shifted 
  72.                         6th element:    alpha-right-shifted 
  73.  
  74.  
  75.  
  76.         o  The key assignment array in an HP48 version E is located at 
  77.            # 7B4E4h in the covered ROM.  While it is not necessary for 
  78.            this to be done, the Array of System Binary can be recalled 
  79.            by using \<< #3FB1Fh SYSEVAL #C612h SYSEVAL \>>.  Implement 
  80.            OUT\-> to decompose the array into its individual elements. 
  81.            The first element in this array of forty nine elements is a 
  82.            System Binary that is the address of an array of six System 
  83.            Binaries that are the addresses of each of the six specific 
  84.            key-shift patterns for the upper most left-hand key.  So to 
  85.            continue associating each of the forty nine elements with a 
  86.            particular key, simply move from left to right, assigning a 
  87.            new element for each one of the 48's keys.  This means that 
  88.            the upper most right-hand key is the sixth element, and the 
  89.            lower most right-hand is the forty ninth array element.   
  90.  
  91.  
  92.                          
  93.                      CORRESPONDING KEYBOARD ARRAY ELEMENTS 
  94.  
  95.  
  96.                [ A ]    [ B ]    [ C ]    [ D ]    [ E ]    [ F ] 
  97.              <7AA5Dh> <7AA94h> <7AACBh> <7AB02h> <7AB39h> <7AB70h> 
  98.  
  99.                [MTH]    [PRG]    [CST]    [VAR]    [ ^ ]    [NXT] 
  100.              <7ABA7h> <7ABDEh> <7AC15h> <7AC4Ch> <7AC83h> <7ACBAh> 
  101.  
  102.                [ ' ]    [STO]   [EVAL]    [ < ]    [ v ]    [ > ] 
  103.              <7ACF1h> <7AD28h> <7AD5Fh> <7AD96h> <7ADCDh> <7AE04h> 
  104.  
  105.                [SIN]    [COS]    [TAN]    [SQx]    [pwr]    [1/x] 
  106.              <7AE3Bh> <7AE72h> <7AEA9h> <7AEE0h> <7AF17h> <7AF4Eh> 
  107.          
  108.               [ENTER]      [+/-]      [EEX]      [DEL]      [<==] 
  109.              <7AF85h>    <7AFBCh>   <7AFF3h>   <7B02Ah>   <7B061h>  
  110.          
  111.               [alpha]      [ 7 ]      [ 8 ]      [ 9 ]      [ / ] 
  112.              <7B098h>    <7B0CFh>   <7B106h>   <7B13Dh>   <7B174h> 
  113.  
  114.               [left]       [ 4 ]      [ 5 ]      [ 6 ]      [ * ] 
  115.              <7B1ABh>    <7B1E2h>   <7B219h>   <7B250h>   <7B287h>  
  116.  
  117.               [right]      [ 1 ]      [ 2 ]      [ 3 ]      [ - ] 
  118.              <7B2BEh>    <7B2F5h>   <7B32Ch>   <7B363h>   <7B39Ah> 
  119.  
  120.               [ ON ]       [ 0 ]      [ . ]      [SPC]      [ + ] 
  121.              <7B3D1h>    <7B408h>   <7B43Fh>   <7B476h>   <7B4ADh> 
  122.  
  123.  
  124.  
  125.         o  Key reassignments are made by replacing array elements that 
  126.            correspond to the appropriate keys.  Utilizing the provided 
  127.            shareware, this is accomplished through the modification of 
  128.            the Array of System Binary stored in the KEYS variable from 
  129.            directory number one, or the Array of Global Name stored in 
  130.            the KEYS variable, but in directory number two instead.  In 
  131.            addition directory two contains forty nine Global variables 
  132.            sequentially named beginning with K.1 through K.49.  Stored 
  133.            in each of these is an Array of System Binary corresponding 
  134.            to the key number from which individual variable names were 
  135.            derived.  Therefore, the Global name K.1 contains the Array 
  136.            of System Binary recovered from the hidden ROM at # 7AA5Dh. 
  137.  
  138.  
  139.  
  140.         o  The Array of System Binary stored in the KEYS variable from 
  141.            directory one is the cache for the default key assignments. 
  142.            This is because it's easiest to begin customizing hard keys 
  143.            by altering the default assignments rather than building an 
  144.            array from scratch.  The scheme used by the first directory 
  145.            to override the default key assignments is quite similar to 
  146.            that of the one found in the 48.  An Array of System Binary 
  147.            is the only type of array that is allowed, and each element 
  148.            must be an address in memory where a second Array of System 
  149.            Binary is located whose elements are the addresses of entry 
  150.            points for the various key configurations associated with a 
  151.            specific key.  This requires knowing the location in memory 
  152.            where the arrays are stored and that once these assignments  
  153.            are made they cannot be moved.  Clearly this application is 
  154.            better suited for software that is hard addressed.  However 
  155.            there are applications for RAM oriented software exploiting 
  156.            this scheme.  For example it might be desirable to reassign 
  157.            the hard keys differently from the factory's.  For instance 
  158.            it would be more convenient for the top row of menu keys to 
  159.            be closer to the numerical keys for someone who was working 
  160.            with hexadecimal integers.  A third directory included here 
  161.            is identical to the first but with one exception; the Array 
  162.            of System Binary has had its elements rearranged so the top 
  163.            row of keys has been exchanged with forth row.  This brings 
  164.            the alpha keys A through F closer to the numerical keys for 
  165.            quicker access.  Implementing CUSTOM swaps row one and four 
  166.            and DEFAULT restores them to their factory assignments. 
  167.  
  168.  
  169.  
  170.         o  The second directory provides the flexibility necessary for 
  171.            software intended to be used in RAM.  Mainly this is due to 
  172.            an embellished CUSTOM function which permits two additional  
  173.            types of arrays to be used.  These additional types include 
  174.            the previously mention Array of Global Name, as well as its 
  175.            library counterpart Array of XLIB Name.  Where the Array of 
  176.            Global Name stored in the KEYS variable contains all of the 
  177.            forty nine sequentially named Global variables.  This means 
  178.            that the routine can now find arrays stored in Global Names 
  179.            or XLIBs as well as by their memory locations.  Furthermore 
  180.            the secondary arrays that house the individual key patterns 
  181.            may also be composed of either Global Names or XLIBs.  This 
  182.            allows user defined functions to be assigned to keys either 
  183.            by their Global Names or XLIBs. 
  184.  
  185.  
  186.  
  187.         o  Reassign a key to functions stored in Global Names or XLIBs 
  188.            by constructing an array of Global Names or XLIBs using the 
  189.            ->ARR command from HACKIT and then storing it in any one or 
  190.            more of the forty nine sequentially named global variables. 
  191.            Once this is done implement the CUSTOM function in order to 
  192.            interrupt the default key assignments.  Restore the default 
  193.            key assignments using the DEFAULT function. 
  194.  
  195.  
  196.  
  197.              Example:  Assign the first menu page of the HACKIT 
  198.                        library to a single key of your choice. 
  199.  
  200.         _________________________               _________________________ 
  201.         |{HOME}                 |               |{HOME}                 | 
  202.         |-----------------------|               |-----------------------| 
  203.         |3:                     |               |4:                     | 
  204.         |2:                     |               |3:                     | 
  205.         |1: { ->ASCI ASCI-> SCRC|               |2:                     | 
  206.         |   SEEK PEEK POKE   }  |               |1:   Array of XLIB Name| 
  207.         |### ### ### ### ### ###|               |### ### ### ### ### ###| 
  208.         -------------------------               ------------------------- 
  209.      1) Place the six commands from          2) Implement OUT-> to explode 
  210.         the first page of HACKIT in             the list and then ->ARR to 
  211.         a list then enter it on the             obtain the array.  Storing 
  212.         on the stack in level one.              it in any K.n assigns that 
  213.        (Display model is not exact.)            key the six library XLIBs. 
  214.  
  215.  
  216.  
  217.         o  These directories effectively permit user defined functions 
  218.            to be assigned to keys without utilization of the USER MODE 
  219.            which is still available for regular use.  Essentially this 
  220.            routine doubles the amount of possible user key assignments 
  221.            previously available.  Extensive measures were taken not to 
  222.            restrict user applications, meaning the scheme has not been 
  223.            one hundred percent idiot-proofed.  Two specific areas that 
  224.            could be potentially dangerous are as follows: 
  225.  
  226.                 +  Do not store any objects other than arrays 
  227.                    in the sequentially named Global variables 
  228.                    because a decision was made to eval rather 
  229.                    than rcl the elements from the KEYS array. 
  230.  
  231.                 +  Avoid using subdirectories for this scheme 
  232.                    because moving up to a parent directory or 
  233.                    the HOME directory without first restoring 
  234.                    control to the default could perhaps cause 
  235.                    a memory loss. 
  236.  
  237.           One final note; if either of these two directories are to be 
  238.           converted to libraries it would be advisable to place all of 
  239.           variables other than CUSTOM and DEFAULT in a list in $HIDDEN 
  240.           in order to hide them in the library.  This is because these 
  241.           two variables are the only ones necessary for the control of 
  242.           the scheme once the key assignments have actually been made. 
  243.           Note that STDKEYS is an RPL subroutine called by CUSTOM.  Do 
  244.           not implement it for any reason.  Both uuencode and ASC have 
  245.           been provided. 
  246.